﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Threading;
using System.Globalization;
using System.Resources;

namespace EnmineKaitlin.MasterPage
{
    public partial class Default : System.Web.UI.MasterPage
    {        
        public EnmineKaitlin.Common.PageBase _PageBase = new EnmineKaitlin.Common.PageBase();
        string LangID = "vi-VN";
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //if (Session["LangID"] != null && Session["LangID"].ToString() == "vi-VN")
                //{
                //    rptNavTop.DataSource = _PageBase._BCategory.Get(ConfigurationManager.AppSettings["list-nav-top-vi"].ToString());
                //    rptGroup.DataSource = _PageBase._BPost.Get(Common.PageBase.ThanhVien_PostID);
                //    rptGroup.DataBind();
                //}
                //else if (Session["LangID"] != null && Session["LangID"].ToString() == "en-US")
                //{
                //    rptNavTop.DataSource = _PageBase._BCategory.Get(ConfigurationManager.AppSettings["list-nav-top-en"].ToString());
                //    LangID = "en-US";
                //    rptGroup.DataSource = _PageBase._BPost.Get(Common.PageBase.Group_PostID);
                //    rptGroup.DataBind();
                //    lblHomePage.Text = "Home";
                //}
                //rptNavTop.DataBind();
                //BindMenuFooter(LangID);
                //rptDonVi.DataSource = _PageBase._BPost.Get(Common.PageBase.DonVi_PostID);
                //rptDonVi.DataBind();
            }
        }
        protected void BindMenuFooter(string LangID)
        {            
            //if (LangID == "vi-VN")
            //{                                
            //    hplAbout.NavigateUrl = "/category/" + Common.PageBase.GioiThieu_CatID +"/"+ Common.PageBase.ConvertTitleSeo(_PageBase.get_category_name(Common.PageBase.GioiThieu_CatID));
            //    hplAbout.Text = _PageBase.get_category_name(Common.PageBase.GioiThieu_CatID);
            //    hplAbout.DataBind();
            //    hplContact.NavigateUrl = "/page/" + Common.PageBase.LienHe_PostID +"/"+ Common.PageBase.ConvertTitleSeo(_PageBase.get_post_name(Common.PageBase.LienHe_PostID));
            //    hplContact.Text = _PageBase.get_post_name(Common.PageBase.LienHe_PostID);
            //    hplContact.DataBind();
            //    hplCarrer.NavigateUrl = "/category/" + Common.PageBase.TuyenDung_CatID + "/" + Common.PageBase.ConvertTitleSeo(_PageBase.get_category_name(Common.PageBase.TuyenDung_CatID));
            //    hplCarrer.Text = _PageBase.get_category_name(Common.PageBase.TuyenDung_CatID);
            //    hplCarrer.DataBind();
            //    hplSitemap.NavigateUrl = "/page/" + Common.PageBase.Sodo_PostID + "/" + Common.PageBase.ConvertTitleSeo(_PageBase.get_post_name(Common.PageBase.Sodo_PostID));
            //    hplSitemap.Text = _PageBase.get_post_name(Common.PageBase.Sodo_PostID);
            //    hplSitemap.DataBind();
            //    hplFAQ.NavigateUrl = "/faq/" + Common.PageBase.HoiDap_CatID + "/" +Common.PageBase.ConvertTitleSeo(_PageBase.get_category_name(Common.PageBase.HoiDap_CatID));
            //    hplFAQ.Text = Common.PageBase.rm.GetString("faq", Common.PageBase.ci);
            //    hplFAQ.DataBind();
            //}
            //else if (LangID == "en-US")
            //{                                
            //    hplAbout.NavigateUrl = "/category/"+Common.PageBase.About_CatID +"/"+ Common.PageBase.ConvertTitleSeo(_PageBase.get_category_name(Common.PageBase.About_CatID));
            //    hplAbout.Text = _PageBase.get_category_name(Common.PageBase.About_CatID);
            //    hplAbout.DataBind();
            //    hplContact.NavigateUrl = "/page/" + Common.PageBase.Contact_PostID +"/"+ Common.PageBase.ConvertTitleSeo(_PageBase.get_post_name(Common.PageBase.Contact_PostID));
            //    hplContact.Text = _PageBase.get_post_name(Common.PageBase.Contact_PostID);
            //    hplContact.DataBind();
            //    hplCarrer.NavigateUrl = "/category/" + Common.PageBase.Carrer_CatID +"/"+ Common.PageBase.ConvertTitleSeo(_PageBase.get_category_name(Common.PageBase.Carrer_CatID));
            //    hplCarrer.Text = _PageBase.get_category_name(Common.PageBase.Carrer_CatID);
            //    hplCarrer.DataBind();
            //    hplSitemap.NavigateUrl = "/page/" + Common.PageBase.SiteMap_PostID +"/"+ Common.PageBase.ConvertTitleSeo(_PageBase.get_post_name(Common.PageBase.SiteMap_PostID));
            //    hplSitemap.Text = _PageBase.get_post_name(Common.PageBase.SiteMap_PostID);
            //    hplSitemap.DataBind();
            //    hplFAQ.NavigateUrl = "/faq/" + Common.PageBase.HoiDap_CatID +"/"+ Common.PageBase.ConvertTitleSeo(_PageBase.get_category_name(Common.PageBase.HoiDap_CatID));
            //    hplFAQ.Text = Common.PageBase.rm.GetString("faq", Common.PageBase.ci);
            //    hplFAQ.DataBind();
            //}
            
        }
        protected string gen_class_nav(int CatID)
        {
            //try
            //{
            //    if (Request.Params["cat"] != null)
            //    {
            //        string strcat = Request.Params["cat"].ToString();
            //        strcat = strcat.Substring(strcat.LastIndexOf("-") + 1);
            //        int cat_request = int.Parse(strcat);
            //        if (CatID == cat_request)
            //        {
            //            return "current-item menu-item";
            //        }
            //    }
            //}
            //catch (Exception ex)
            //{
            //    return "menu-item";
            //}
            return "menu-item";
        }
        /// <summary>
        /// Thay đổi ngôn ngữ
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void ChangeLanguage(object sender, CommandEventArgs e)
        {
            //Session["LangID"] = e.CommandArgument;
            //Thread.CurrentThread.CurrentCulture = new CultureInfo(Session["LangID"].ToString());
            //Common.PageBase.rm = new ResourceManager("Resources.Language", System.Reflection.Assembly.Load("App_GlobalResources"));
            //Common.PageBase.ci = Thread.CurrentThread.CurrentCulture;
            //Response.Redirect("~/home");
        }
        /// <summary>
        /// Chuyển dữ liệu sang trang tìm kiếm
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            //string word = txtWord.Text;
            //Response.Redirect("/search.aspx?s=" + word);
        }
    }
}
